package day1217;

public class Minnumber {
    public static int find(int[] arr) {
        int temp = 1;
        while (true) {
            boolean flag = false;
            for (int i = 0; i < arr.length; i++) {
                if (arr[i] == temp) {
                    temp = arr[i] + 1;
                    flag = true;
                    break;
                }
            }
            if (!flag)
                break;
        }
        return temp;
    }

    public static void exchange(int[] a) {
        //保证相对位置不变，奇数在前
        int i=0,j=a.length-1;
        while(i<j){
            //先从左边找第一个偶数
            while (i<j&&a[i]%2!=0)
                i++;
            //再从右边找第一个奇数
            while (j>i&&a[i]%2==0)
                j--;
            if(i<j){
                int temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
    }

    public static void paoSort(int[] a){
        for(int i=0;i<a.length;i++){
            for(int j=0;j<a.length-i-1;j++){
                if(a[j]>a[j+1]){
                    int temp = a[j];
                    a[j] = a[j+1];
                    a[j+1] = temp;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] a = {1, 3, 2, 4, 5, 3, 41, 74, 4};

    }
}
